package com.chengdu.chun.mapper;

import com.chengdu.chun.po.Room;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface RoomMapper {

    /**
     * 根据宿舍id获取宿舍信息
     * @param rid
     * @return
     */
    @Select("select * from room where rid = #{rid}")
    public Room getRoomByrid(int rid);

    List<Room> getRoomByName(String rname);

    @Select("select * from room limit #{count},#{num}")
    List<Room> getRoomListBypage(@Param("count") long count, @Param("num")int num);

    @Select("select count(*) from room")
    int selectAllCountRoom();

    /**
     * 根据房间状态查询房间的总数
     *
     * @param status
     * @return
     */
    @Select("select count(*) from room where rstatus=#{status}")
    int selectCountRoom(int status);

    int deleteByPrimaryKey(Integer rid);

    int insert(Room record);

    int insertSelective(Room record);

    Room selectByPrimaryKey(Integer rid);

    int updateByPrimaryKeySelective(Room record);

    int updateByPrimaryKey(Room record);
}